<%= header %>
<%= boomerangScript %>
<script src="43-payload-fetch.js" type="text/javascript"></script>
<script>
var t = BOOMR_test;
BOOMR_test.init({
	instrument_xhr: true,
	AutoXHR: {
		monitorFetch: true
	},
	testAfterOnBeacon: BOOMR.plugins.AutoXHR && t.isFetchApiSupported() ? 3 : 1,
	afterFirstBeacon:
		function() {
			if (!BOOMR.plugins.AutoXHR || !t.isFetchApiSupported()) {
				return;
			}

			BOOMR.subscribe("xhr_load", function(evt) {
				window.xhrResponse1 = evt.response;
				window.xhrRequestPayload1 = evt.requestPayload;

				BOOMR.subscribe("xhr_load", function(evt2) {
					window.xhrResponse2 = evt2.response;
					window.xhrRequestPayload2 = evt2.requestPayload;
				});

				// turn on inspection
				BOOMR.plugins.AutoXHR.setXhrRequestResponseCapturing(true);

				// fire another fetch
				var p = fetch("/json?2", {method: "POST", body: "ABC"});

			}, null, null, true);

			// start a fetch
			window.p = fetch("/json?1", {method: "POST", body: "ABC"});
		}
});
</script>
<%= footer %>
